package models

import (
	"kop/libs/database"
	"kop/modules/role/entity"
)

func GetOnline(roleID int32) entity.Online {

	var data = entity.Online{RoleID: roleID}

	if err := database.DB.FirstOrCreate(&data).Error; err != nil {
		panic(err)
	}

	return data
}

func SaveOnline(data *entity.Online) error {

	return database.DB.Save(data).Error
}
